package org.jeecg.modules.monitoring.j_monitoring.entity.software;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.modules.monitoring.j_monitoring.entity.LicenseContractNew;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 软件模块设置
 * @Author: xiaoyq
 * @Date:   2023-8-2
 * @Version: V1.0
 */
@Data
@TableName("software_module_setting")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="软件模块设置对象", description="软件模块设置")
public class SoftwareModuleSetting implements Serializable {
    private static final long serialVersionUID = 1L;

    /**id*/
    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty(value = "id")
    private Integer id;
    /**softwareid*/
    @Excel(name = "softwareid", width = 15)
    @ApiModelProperty(value = "softwareid")
    @TableField(value = "softwareid")
    private Integer softwareid;
    /**modulename*/
    @Excel(name = "modulename", width = 15)
    @ApiModelProperty(value = "modulename")
    @TableField(value = "modulename")
    private String modulename;
    /**licensename*/
    @Excel(name = "licensename", width = 15)
    @ApiModelProperty(value = "licensename")
    @TableField(value = "licensename")
    private String licensename;
    /**description*/
    @Excel(name = "description", width = 15)
    @ApiModelProperty(value = "description")
    @TableField(value = "description")
    private String description;
    /**iskernel*/
    @Excel(name = "iskernel", width = 15)
    @ApiModelProperty(value = "iskernel")
    @TableField(value = "iskernel")
    private Integer iskernel;

    @Excel(name = "是否显示", width = 15)
    @ApiModelProperty(value = "是否显示")
    @TableField(value = "isshow")
    private Integer isshow;

    /**创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    @TableField(value = "createtime")
    private Date createtime;

    /**创建时间*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    private Date updateTime;

    //0：初始状态，1：表示存在，2：不存在（需要删除）、3：刚新增
    @ApiModelProperty(value = "状态")
    @TableField(value = "Status")
    private String Status;

    @ApiModelProperty(value = "是否删除")
    @TableField(value = "Is_Deleted")
    private String IsDeleted;

    public static SoftwareModuleSetting from(LicenseContractNew entity){
        SoftwareModuleSetting setting = new SoftwareModuleSetting();
        setting.setId(entity.getId());
        setting.setSoftwareid(entity.getSoftwareid());
        setting.setModulename(entity.getModulename());
        setting.setDescription(entity.getDescription());
        setting.setLicensename(entity.getLicensename());
        setting.setIsshow(0);
        setting.setStatus("3");

        return setting;
    }

    public void copy(LicenseContractNew entity){
        SoftwareModuleSetting setting = this;
        setting.setId(entity.getId());
        setting.setSoftwareid(entity.getSoftwareid());
        setting.setModulename(entity.getModulename());
        setting.setDescription(entity.getDescription());
        setting.setIskernel(entity.getIskernel());
        setting.setLicensename(entity.getLicensename());
    }
}


